Repository navigation
feat: GSM Secrets - Backfill API to move plain-text secrets into the store - #477
Open
yuechao-qin wants to merge 6 commits into
Open
yuechao-qin wants to merge 6 commits into
yuechao-qin wants to merge 6 commits into
Conversation
# Conflicts: # tests/test_secret_value_store.py
…nvalid rows, stops on errors Returns moved, skipped, left_in_table and stopped_on; skipped rows do not count toward limit.
Comment on lines
+638
to
+640
| return secrets_service.backfill_secret_storage( | ||
| session=session, limit=limit, user_id=user_id, secret_name=secret_name | ||
| ) |
# Conflicts: # tests/test_secret_store.py
… store, delete The routes no longer move rows, so the backfill owns the move. A copy left by a stopped run is replaced by the row.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
An admin route moves the rows still in the database (
secrettable) into the secret store, a batch at a time, until the table is empty. Responses below are the ones the tests assert:movedlimitskippedApiValidationError, e.g. a value too large); they stay in the table and do not count towardlimitleft_in_tablestopped_onnull; run it again once fixeduser_idandsecret_namenarrow the run to matching rows. Admins only; with nosecret_storegiven, the route is a 422.Each row moves in one commit: lock the row,
createit in the store with every column, delete the row. If the store already has it, an earlier run stopped after copying; the row is still the truth, soupdatereplaces the copy. A PUT or DELETE of the same row waits on the lock, then finds no row and goes to the store.Why
#474 sends new secrets to the store but never moves existing rows, so that a request does only what it says. This is the one place rows move. It is safe to repeat and to run while the secret routes are in use, because each move locks its row.
Verification
tests/test_secret_store.py, through the route: no store → 422; non-admin → 403;limitcaps the moves and a second run finishes;user_idandsecret_namefilters; an invalid row is skipped, listed and not counted; an error stops the run with its row and text, and a rerun finishes; every column is carried; a copy left by a stopped run is replaced by the row; the row is locked while it moves.descriptionorextra_data, not deleting the row, not committing each row, ignoringlimit, counting skipped rows, stopping on an invalid row, not catching other errors, carrying on after one, and ignoring the filters each turn tests red. The rollback after a skipped row only releases a row lock, which SQLite does not take, so no test here can see it.tests/instrumentation/test_execution_tracing.pyfail onmaster. Also passes on Python 3.14.